package org.jeecg.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.jeecg.domain.Care;
import org.jeecg.domain.User;

import java.util.List;

@Mapper
public interface CareMapper {

    @Select("select * from sys_user s where EXISTS (select 1 from care c where username = #{username} and s.username = c.care_username)")
    List<User> getCares(String username);


    @Insert("insert into care (id,username,care_username,create_time) values (#{id},#{username},#{careUsername},#{createTime})")
    Integer insertCare(Care care);

    @Select("select * from care where username = #{username} and care_username = #{careUsername}")
    Care queryCare(String username,String careUsername);


    @Delete("delete from care where username =#{username} and care_username = #{careUsername}")
    Integer deleteCare(String username,String careUsername);


}
